package com.ydd.controller.admin;

import com.ydd.dto.SysRoleQueryDTO;
import com.ydd.result.Result;
import com.ydd.service.RoleService;
import com.ydd.vo.SysRolePageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sys_role")
@Slf4j
@Api(tags = "账号角色")
public class RoleController {

    @Autowired
    private RoleService roleService;

    /**
     * 根据name分页查询
     * @param sysRoleQueryDTO
     * @return
     */
    @GetMapping("/list")
    @ApiOperation("角色分页查询")
    public Result findPageByName(SysRoleQueryDTO sysRoleQueryDTO){
        log.info("根据name分页查询数据:{}",sysRoleQueryDTO);
        SysRolePageVO sysRolePageVO=roleService.findPageByName(sysRoleQueryDTO);
        return Result.success(sysRolePageVO);
    }
}
